//
//  TKL_SettingVC.m
//  TKL_EnPro
//
//  Created by 雅恩三河科技 on 2018/12/18.
//  Copyright © 2018年 MrZhang. All rights reserved.
//

//
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//                  \./                  \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
//
//

#import "TKL_SettingVC.h"

@interface TKL_SettingVC ()

@end

@implementation TKL_SettingVC
-(void)initilization
{
    self.isGroup=YES;
    self.navigationItem.title = @"设置";
    self.extendedLayoutIncludesOpaqueBars = YES;
    //self.navigationController.navigationBar.shadowImage = [[UIImage new]rt_darkenWithLevel:0.3f];

    [self.view addSubview:self.baseTable];

    self.baseTable.contentInset = UIEdgeInsetsMake([self topShelterHeight], 0, [self bottomShelterHeight], 0);
    [self.baseTable setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
    [self.baseTable setSeparatorColor: Main_Color_BG];
    [self.baseTable setBackgroundColor:Main_Color_BG];
    [self.baseTable setTintColor:Main_Color_BG];
    @WeakSelf;
    
    [self viewModelBand];
    [self reloadData];
}
-(void)viewModelBand
{
    @WeakSelf;
    //    GCBaseObservationModel *observation = [GCBaseObservationModel new];
    //    observation.observation = self.viewModel;
    //    observation.keyPath = @"datas";
    //    observation.handler = ^(NSString *keyPath) {
    //        [selfp reloadView];
    //    };
    //    [self registObservation:observation];
}
-(void)reloadData
{
    //[self.viewModel requestDatas];
}
-(void)reloadView
{
    [self.baseTable reloadData];
}
#pragma mark - life
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self initilization];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */
#pragma mark - delegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return 3;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    @WeakSelf;
    
    static NSString* identify=@"ppPKPhonecell";
    UITableViewCell* cell=[tableView dequeueReusableCellWithIdentifier:identify];
    if (!cell) {
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identify];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
        cell.backgroundColor=[UIColor whiteColor];
        
    }
    NSArray* arr=@[@"修改密码",@"清除缓存",@"当前版本"];
    cell.textLabel.text=arr[indexPath.row];
    cell.textLabel.font=SYSTEMFONT(14);
    cell.textLabel.textColor=HEXCOLOR(@"#171717");
    
    
    
    cell.detailTextLabel.font=SYSTEMFONT(14);
    cell.detailTextLabel.textColor=HEXCOLOR(@"#171717");
    
    if (indexPath.row==2) {
        cell.accessoryType=UITableViewCellAccessoryNone;
        cell.detailTextLabel.text=@"版本1.0";
    }else
    {
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        cell.detailTextLabel.text=@"";
    }
    
    
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return WFCGFloatY(45);
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = (UITableViewCell *)[self tableView:tableView cellForRowAtIndexPath:indexPath];
    CGFloat height = cell.height;
    return height;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.row==0)
    {
        Class class=NSClassFromString(@"TKL_ChangePassWordVC");
        if (class) {
            UIViewController* vc=[[class alloc] init];
            [self.navigationController pushViewController:vc animated:YES];
        }
    }
    if (indexPath.row==1)
    {
 
        [FTIndicator showSuccessWithMessage:@"清除成功"];
    }
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return nil;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView* view=[UIView new];
    view.backgroundColor=Main_Color_BG;
    UIButton* loginBtn = [[UIButton alloc]init];
    loginBtn.frame = WFCGRectMake(20, 40, 335, 45);
    [loginBtn setBackgroundImage:[WFFunctions WFUICreateImageWithColor:Main_Color] forState:UIControlStateNormal];
    [loginBtn setTitle:@"退出登录" forState:UIControlStateNormal];
    [loginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [WFFunctions WFUIaddbordertoView:loginBtn radius:4 width:0 color:[UIColor clearColor]];
    loginBtn.titleLabel.font = SYSTEMFONT(15);
    [loginBtn handleControlEvent:UIControlEventTouchUpInside withBlock:^{
        [[TKL_LoginViewModel shareInterface] setInfoModel:nil];
        [[TKL_LoginViewModel shareInterface] setIsLogin:NO];
        [FTIndicator showInfoWithMessage:@"成功退出登录"];
        
    }];
    [view addSubview:loginBtn];
    return view;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 100;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 5;
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    NSLog(@"--%ld",buttonIndex);
}

@end


/*
 11111111111111111111111111111111111111001111111111111111111111111
 11111111111111111111111111111111111100011111111111111111111111111
 11111111111111111111111111111111100001111111111111111111111111111
 11111111111111111111111111111110000111111111111111111111111111111
 11111111111111111111111111111000000111111111111111111111111111111
 11111111111111111111111111100000011110001100000000000000011111111
 11111111111111111100000000000000000000000000000000011111111111111
 11111111111111110111000000000000000000000000000011111111111111111
 11111111111111111111111000000000000000000000000000000000111111111
 11111111111111111110000000000000000000000000000000111111111111111
 11111111111111111100011100000000000000000000000000000111111111111
 11111111111111100000110000000000011000000000000000000011111111111
 11111111111111000000000000000100111100000000000001100000111111111
 11111111110000000000000000001110111110000000000000111000011111111
 11111111000000000000000000011111111100000000000000011110001111111
 11111110000000011111111111111111111100000000000000001111100111111
 11111111000001111111111111111111110000000000000000001111111111111
 11111111110111111111111111111100000000000000000000000111111111111
 11111111111111110000000000000000000000000000000000000111111111111
 11111111111111111100000000000000000000000000001100000111111111111
 11111111111111000000000000000000000000000000111100000111111111111
 11111111111000000000000000000000000000000001111110000111111111111
 11111111100000000000000000000000000000001111111110000111111111111
 11111110000000000000000000000000000000111111111110000111111111111
 11111100000000000000000001110000001111111111111110001111111111111
 11111000000000000000011111111111111111111111111110011111111111111
 11110000000000000001111111111111111100111111111111111111111111111
 11100000000000000011111111111111111111100001111111111111111111111
 11100000000001000111111111111111111111111000001111111111111111111
 11000000000001100111111111111111111111111110000000111111111111111
 11000000000000111011111111111100011111000011100000001111111111111
 11000000000000011111111111111111000111110000000000000011111111111
 11000000000000000011111111111111000000000000000000000000111111111
 11001000000000000000001111111110000000000000000000000000001111111
 11100110000000000001111111110000000000000000111000000000000111111
 11110110000000000000000000000000000000000111111111110000000011111
 11111110000000000000000000000000000000001111111111111100000001111
 11111110000010000000000000000001100000000111011111111110000001111
 11111111000111110000000000000111110000000000111111111110110000111
 11111110001111111100010000000001111100000111111111111111110000111
 11111110001111111111111110000000111111100000000111111111111000111
 11111111001111111111111111111000000111111111111111111111111100011
 11111111101111111111111111111110000111111111111111111111111001111
 11111111111111111111111111111110001111111111111111111111100111111
 11111111111111111111111111111111001111111111111111111111001111111
 11111111111111111111111111111111100111111111111111111111111111111
 11111111111111111111111111111111110111111111111111111111111111111
 
 
 */
